package com.sss.otep.web.actions.page.json;

import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.sss.otep.client.grid.MemberRow;
import com.sss.otep.client.proxy.OTEPWebServiceProxy;

@ParentPackage("json")
@Result(name = "JSON", type = "json", params = { "enableGZIP", "true",
		"noCache", "true", "ignoreHierarchy", "false" })
public class InvokeMemberAction extends GridBaseAction<MemberRow> {
	private static final long serialVersionUID = 6581394523001240398L;

	private static final Logger log = LoggerFactory
			.getLogger(InvokeMemberAction.class);

	@Autowired
	private OTEPWebServiceProxy proxy;

	@Override
	public void doProcess() {
		log.info("invoke member data from web service");
		try {
			this.setGridModel(proxy.loadMember(getParam()));
		} catch (Exception e) {
			this.setSuccess(false);
			this.setErrorMessage(e.getMessage(),e);
			
			log.error(" !! Exception occured... ", e);
		}
	}
}
